home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Guia 2004 June
/
Mega Guia: 2004-06.iso
/
_files
/
free
/
myalbum
/
ES
/
myalbumsetup.exe
/
{app}
/
AutoTab.vbs
next >
Wrap
Text File
|
2003-02-16
|
2KB
|
56 lines
' ------------------------------------------------------------------------------------
' Create tabs for an album
'
' This script analyses the current album and create a keyword tab for
' every folder a picture is found in.
' ------------------------------------------------------------------------------------
Option Explicit
app.ClearTrace
dim alb
set alb = app.GetCurrentAlbum
dim s, k
s = "This script will create tabs based on the picture folders." & chr(13) & chr(13)
s = s & "This album will be used: " & alb.sAlbumTitle & " (" & alb.FullName & ")" & chr(13)
s = s & "Click Yes to proceed" & chr(13)
s = s & "Click No to abort"
k = MsgBox( s, vbYesNo, "AutoTaber" )
if k = vbYes then
dim i, j, kw, pos1, pos2, folder
' Process each picture
Dim nbPic
nbPic = alb.nbPicture
app.Trace "Pictures to process: " & nbPic, -1, TRACE_INFORMATION
dim pic, pic2, filename
for i = 0 to nbPic-1
Set pic = alb.GetPicture(i)
' Get the relative path of the picture
filename = alb.ExpandMacro( pic, "%RP" )
app.Trace "Processing picture #" & i+1 & " " & filename
pos1 = InstrRev( filename, "\" )
if pos1 > 0 then
pos2 = InstrRev( filename, "\", pos1-1 )
if pos2 <> 0 then
folder = mid( filename, pos2+1, pos1-pos2-1 )
set kw = alb.addKeyword( folder )
kw.bIsTab = True
pic.SetKeyword folder, True
end if
end if
next
alb.Redraw
app.Trace "Done !", -1, TRACE_GREENDOT
end if